home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / xvidoc.zip / SOURCE.LST < prev    next >
File List  |  1992-07-28  |  56KB  |  1,519 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                Notes on the Xvi Source Code
  11.  
  12.  
  13.                    Chris Downey
  14.                 John Downey
  15.  
  16.  
  17.  
  18.            Xvi (pronounced _e_c_k_s-_v_e_e-_e_y_e) is a free, portable,
  19.       multi-window implementation of the popular UNIX|- editor
  20.       vi.
  21.  
  22.       This document contains information on how to  port  xvi
  23.       to  systems  not currently supported.  It also explains
  24.       how the xvi source code is arranged into  modules,  and
  25.       explains some of the data structures which are used, so
  26.       that modifications may be made if and when necessary to
  27.       the editor itself.
  28.  
  29.  
  30.  
  31.      _1.  _I_N_T_R_O_D_U_C_T_I_O_N
  32.  
  33.      Xvi is intended to be portable to just about any system.  This is
  34.      one of the central reasons for its existence; the authors wish to
  35.      be able to use the same editor everywhere.
  36.  
  37.      The main body of  the  editor  is  (supposedly)  fully  portable,
  38.      relying  only  on  standard facilities defined by the White Book,
  39.      and on a set of _p_r_i_m_i_t_i_v_e_s which are provided by a set of one  or
  40.      more  modules for each operating system.  If ___S_T_D_C__ is defined,
  41.      certain ANSI C facilities will  be  used,  but  the  editor  will
  42.      compile with non-ANSI compilers.
  43.  
  44.      Therefore, in order to port xvi to a  new  system,  all  that  is
  45.      necessary  is  to provide the defined set of _p_r_i_m_i_t_i_v_e_s, and then
  46.      build the editor.  Or at least, that's the idea; we have  refined
  47.      the  set of primitives as we port the editor to new environments,
  48.      and it's getting pretty easy now.
  49.  
  50.      The rest of this document is divided into sections as follows:
  51.  
  52.      _S_e_c_t_i_o_n _2: _S_y_s_t_e_m-_S_p_e_c_i_f_i_c _M_o_d_u_l_e_s
  53.       This section deals with  the  layout  of  source  files  and
  54.       makefiles which you will have to deal with when porting xvi.
  55.  
  56.      _S_e_c_t_i_o_n _3: _P_r_i_m_i_t_i_v_e_s _P_r_o_v_i_d_e_d _b_y _x_v_i
  57.       Discusses what primitives are provided by the main  body  of
  58.       the editor source code for use by the system interface code.
  59.      _________________________
  60.      |- UNIX is a trademark of Bell Laboratories.
  61.  
  62.  
  63.  
  64.      _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2                                        _P_a_g_e _1
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      _2                                           _X_v_i _S_o_u_r_c_e _C_o_d_e _N_o_t_e_s
  71.  
  72.  
  73.      _S_e_c_t_i_o_n _4: _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e
  74.       Explains the primitives which need to be provided  in  order
  75.       to make xvi work.
  76.  
  77.      _S_e_c_t_i_o_n _5: _D_a_t_a _S_t_r_u_c_t_u_r_e_s
  78.       Details the internal data types used in the editor, and  any
  79.       functions available for operating on those types.
  80.  
  81.      _S_e_c_t_i_o_n _6: _S_o_u_r_c_e _F_i_l_e_s
  82.       Lists the source files comprising the editor,  and  explains
  83.       what functionality is provided by each one.
  84.  
  85.  
  86.  
  87.      _2.  _S_Y_S_T_E_M-_S_P_E_C_I_F_I_C _M_O_D_U_L_E_S
  88.  
  89.      The system-specific code normally consists  of  three  (or  more)
  90.      files; a ".c" file, a ".h" file, and a makefile.  For example:
  91.  
  92.          _q_n_x._c
  93.          _q_n_x._h
  94.          _m_a_k_e_f_i_l_e._q_n_x
  95.  
  96.      comprise the system-specific module for the QNX operating system.
  97.  
  98.      In most cases, the system-specific code is divided  into  two  or
  99.      more  modules,  where one (called the _s_y_s_t_e_m _i_n_t_e_r_f_a_c_e _m_o_d_u_l_e) is
  100.      concerned with general interactions with the operating system and
  101.      the  other (called the _t_e_r_m_i_n_a_l _i_n_t_e_r_f_a_c_e _m_o_d_u_l_e) is designed for
  102.      a specific interface to a display and keyboard (and  possibly,  a
  103.      mouse).
  104.  
  105.      For example, the  generic  UNIX  implementation  has  _u_n_i_x._c  and
  106.      _u_n_i_x._h  for  the  system  interface  module,  and  _t_e_r_m_c_a_p._c  and
  107.      _t_e_r_m_c_a_p._h for the terminal interface  module;  this  should  work
  108.      reasonably with any full-duplex terminal that can be described in
  109.      the _t_e_r_m_c_a_p database.  On consoles with  memory-mapped  displays,
  110.      or  systems  with  graphic  user  interfaces,  however, it may be
  111.      possible to achieve faster display updating,  and  perhaps  other
  112.      benefits,  by  replacing the _t_e_r_m_c_a_p module with another one that
  113.      makes better use  of  whatever  facilities  are  available.   For
  114.      instance,  there  is  an  experimental version for SunView, which
  115.      allows mouse input on Sun workstations running the SunView window
  116.      system.
  117.  
  118.      On  the  other  hand,   the   _t_e_r_m_c_a_p-specific   routines   might
  119.      conceivably  be  useful  on some other operating systems (such as
  120.      VMS), so in general it seemed a good idea to  make  the  _t_e_r_m_c_a_p-
  121.      specific routines a separate module.
  122.  
  123.      The  current  MS-DOS  implementation  has  a  separate   terminal
  124.      interface  module,  which  is  designed  specifically  for IBM PC
  125.      compatible computers.  This is in the files
  126.  
  127.  
  128.  
  129.  
  130.      _P_a_g_e _2                                        _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      _X_v_i _S_o_u_r_c_e _C_o_d_e _N_o_t_e_s                                           _3
  137.  
  138.  
  139.  
  140.          _i_b_m_p_c__a._a_s_m
  141.          _i_b_m_p_c__c._c
  142.          _i_b_m_p_c._h
  143.  
  144.      The first of these is written in assembly language because  there
  145.      are  not enough routines common to the various MS-DOS C compilers
  146.      which reliably access the display and keyboard at  a  low  enough
  147.      level.
  148.  
  149.      The hardware-independent system interface module for MS-DOS is in
  150.  
  151.          _m_s_d_o_s__a._a_s_m
  152.          _m_s_d_o_s__c._c
  153.          _m_s_d_o_s._h
  154.  
  155.      The first of these is written in assembly language for  the  same
  156.      reason as is _i_b_m_p_c__a._a_s_m.
  157.  
  158.      Theoretically, different  terminal  interface  modules  could  be
  159.      written  for MS-DOS systems running on hardware which is not IBM-
  160.      compatible but, unfortunately, such systems seem to be  virtually
  161.      extinct nowadays.
  162.  
  163.      Sometimes more than one makefile is provided, as in the  case  of
  164.      UNIX, where different versions work in slightly different ways.
  165.  
  166.      It is, of couse, not necessary to provide all - or any - of these
  167.      files for a particular implementation; this is just a convention.
  168.      The makefile(s) for each system determine what files are used  in
  169.      the compilation of the editor.
  170.  
  171.      The following porting modules are available at present:
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.      _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2                                        _P_a_g_e _3
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      _4                                           _X_v_i _S_o_u_r_c_e _C_o_d_e _N_o_t_e_s
  203.  
  204.      ________________________________________________________________
  205.     |         System        |    Makefile  |       Source Files     |
  206.     |________________________|_______________|_________________________|
  207.     | UNIX                  |              |                        |
  208.     |   BSD                 |  makefile.bsd|  unix.[ch] termcap.[ch]|
  209.     |   System V |-          |  makefile.usg|  unix.[ch] termcap.[ch]|
  210.     |   AIX                 |  makefile.aix|  unix.[ch] termcap.[ch]|
  211.     |   ULTRIX              |  makefile.ult|  unix.[ch] termcap.[ch]|
  212.     |   Xenix |-             |  makefile.xen|  unix.[ch] termcap.[ch]|
  213.     |   POSIX (e.g. BSDI)   |  makefile.pos|  unix.[ch] termcap.[ch]|
  214.     |   SunOS               |  makefile.sun|  unix.[ch] termcap.[ch]|
  215.     |   SunView             |  makefile.sv |  unix.[ch] sunview.h   |
  216.     |                       |              |  sunfront.c sunback.c  |
  217.     |                       |              |  xvi.icn               |
  218.     |________________________|_______________|_________________________|
  219.     |                       |              |                        |
  220.     | MS-DOS                |              |  msdos_c.c msdos.h     |
  221.     |                       |              |  ibmpc_c.c ibmpc.h     |
  222.